<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<script type="text/javascript" src="../js/controller/room/RM007A.js" ></script>


	<script type="text/javascript">
		$(document).ready(function() {
		    
			var tower = "${model.rlsttower}";
			var floor = "${model.rlstfloor}";
			var unit = "${model.rlstunitno}";
			var addr = "${model.rlstaddr}";
			var obj = {
				'tower' : tower,
				'floor': floor,
				'unitNo' : unit,
				'address' : addr
			}
			_log(obj);
			if(tower!=''){
				_COMBOBOX.TowerFloorUnitAddrCombo('tower', 'floor' , 'unit' , 'address' , 'roomId', obj); // Load Tower Criteria Combobox

			}else{
				_COMBOBOX.TowerFloorUnitAddrCombo('tower', 'floor' , 'unit' , 'address' , 'roomId',null); // Load Tower Criteria Combobox
			}
			
			    _COMMON.renderDatePicker('ownTransferDate');
			    _COMMON.renderDatePicker('tntTransferDate');
			    
		   	RM007A.tntFunction = function(v) {
					if(v !='Y'){
					    $("[name*='model.tntModel']").clear();
					    $("[name*='model.tntModel']").addClass( "input-readOnly" );
					}else{
				     	$("[name*='model.tntModel']").removeClass('input-readOnly')
				    
					}
		     		
			} 
		   	

			RM007A.tntFunction("${model.tntModel.rtntstat}");
			
			 $("#btnSubmit").click(function() {
// 				_log(RM001A.validate());
// 				if(RM001A.validate()){
				    $('#RM007Form').submit();
// 				}
			    });  
			
			    
		});
		
		
	</script>

<style>
input[type=text] {
width: 280px !important;
}
</style>

<form id="RM007Form" action="RM007Asave" method="get">
<div id="container">
	<div id="content">
		<div class="warpper">
			<table class="from" style="width: 100%;">
				<tr>
					<td class="header2" style="border-bottom: 1px #bbb solid;">Criteria</td>
				</tr>
			</table>
			
<%-- 			${model.ownModel} --%>
<%-- ${model} --%>

			<input id="roomId1" name="model.rlrmid" value="${param.rlrmid}" type="hidden"> <!--  Room ID For Save & Edit -->
			<input id="roomId2" name="model.ownModel.rlrmid" value="${param.rlrmid}" type="hidden"> <!--  Room ID For Save & Edit -->
			<input id="roomId3" name="model.tntModel.rlrmid" value="${param.rlrmid}" type="hidden"> <!--  Room ID For Save & Edit -->
			<s:set var="editable">${empty param['rlrmid']? '':'input-readOnly'}</s:set>
	
<!-- 			<form action="" method="get" name="main"> -->
			<table class="from" style="width: 100%;" border="0">
				<tr>
					<td class="header">Tower </td>
					<td><select id="tower"  class="required input-readOnly">
					</select><span class="required"></span></td>
				
					<td class="header">Floor </td>
					<td><select id="floor" class="required ${editable}"></select><span class="required"></span></td>
				
					<td class="header">Unit </td>
					<td><select id="unit"  class="required ${editable}"></select><span class="required"></span></td>
				
					<td class="header">Address </td>
					<td><select id="address" class="required ${editable}"></select><span class="required"></span></td>
				
				</tr>
<!-- 				<tr > -->
<!-- 					<td  class="header">Type :</td> -->
<!-- 					<td><input id="type" name="type" type="text" style="width: 120px;"></td> -->
<!-- 					<td  class="header" colspan="6"></td> -->
<!-- 				</tr> -->
			</table>
<!-- 			</form> -->
	<!-- 		end	Criteria -->
			<table class="from" style="width: 100%;">
				<tr>
					<td class="header2" style="border-bottom: 1px #bbb solid;">Detail</td>
				</tr>
			</table>		
<%-- 		${model.ownModel} --%>
		
<!-- 			<form action="" method="get" name="tabMain"> -->
			<div id="tabs">
					  <ul>
					    <li><a href="#tabs-1">Owner</a></li>
					    <li><a href="#tabs-2">Tenant</a></li>
					  </ul>
			
			<div id="tabs-1">
					<!-- 		Tab 1 -->
			<table class="from" border="0">
				<tr >
					<td class="header">Status :</td>
					<td>
						<label class="radio-inline"> <input type="radio" 
							name="model.ownModel.rownstat" checked 
							 ${model.ownModel.rownstat == 'Y' ? 'checked=""' : ''} class="ng-pristine ng-valid" value="Y">
							Active
						</label> <label class="radio-inline"> <input type="radio"
							name="model.ownModel.rownstat" ${model.ownModel.rownstat == 'N' ? 'checked=""' : ''}
							class="ng-pristine ng-valid"  value="N">
							Inactive
						</label>
					</td>
					<td class="header" colspan="2"</td>
				</tr>
				<tr >
					<td class="header">Prefix(Eng) :</td>
					<td><input  name="model.ownModel.rownprenm"  type="text" value="${model.ownModel.rownprenm }"><span class="required"></span>
					</td>
					<td class="header">Prefix(Thai) :</td>
					<td><input name="model.ownModel.rownprlnm"  type="text" value="${model.ownModel.rownprlnm }"><span class="required"></span>
					</td>
				</tr>
				<tr >
					<td class="header">FirstName(Eng) :</td>
					<td><input name="model.ownModel.rownfsenm"  type="text" value="${model.ownModel.rownfsenm }"><span class="required"></span></td>
					<td class="header">FirstName(Thai) :</td>
					<td><input  name="model.ownModel.rownfslnm"  type="text" value="${model.ownModel.rownfslnm }"></td>
				</tr>
				<tr >
					<td class="header">MidName(Eng) :</td>
					<td><input  name="model.ownModel.rownmdenm"  type="text" value="${model.ownModel.rownmdenm }"></td>
					<td class="header">MidName(Thai) :</td>
					<td><input name="model.ownModel.rownmdlnm"  type="text" value="${model.ownModel.rownmdlnm }"></td>
				</tr>
				<tr >
					<td class="header">LastName(Eng) :</td>
					<td><input  name="model.ownModel.rownlsenm"  type="text" value="${model.ownModel.rownlsenm }"><span class="required"></span></td>
					<td class="header">LastName(Thai) :</td>
					<td><input   name="model.ownModel.rownlslnm"  type="text" value="${model.ownModel.rownlslnm }"></td>
				</tr>
				<tr >
					<td class="header">Nationality :</td>
					<td><input  name="model.ownModel.rownnation"  type="text" value="${model.ownModel.rownnation }"><span class="required"></span></td>
					<td class="header">Passport :</td>
					<td><input   name="model.ownModel.rownpassno"  type="text" value="${model.ownModel.rownpassno }"></td>
				</tr>
				<tr >
					<td class="header">Transfer Date :</td>
					<td><input id="ownTransferDate" name="model.ownModel.rowntfsdat"  type="text" value="${rowntfsdat }"></td>
					<td class="header">Agent :</td>
					<td><input   name="model.ownModel.rownagt"  type="text" value="${model.ownModel.rownagt }"></td>
				</tr>
				<tr >
					<td class="header">Tel. :</td>
					<td><input id="tel" name="model.ownModel.rowntel"  type="text" value="${model.ownModel.rowntel }"></td>
					<td class="header">Address :</td>
					<td rowspan="3" valign="top"><textarea id="tabAddress"  name="model.ownModel.rownaddr" cols="50"  rows="6">${model.ownModel.rownaddr }</textarea></td>
				</tr>
				<tr >
					<td class="header">Mobile Phone :</td>
					<td><input  name="model.ownModel.rowntel2"  type="text" value="${model.ownModel.rowntel2 }"></td>
					<td class="header" colspan="1"></td>
<!-- 					<td class="header" colspan="1"></td> -->
				</tr>
				<tr >
					<td class="header">Email :</td>
					<td><input  name="model.ownModel.rownemail"  type="text" value="${model.ownModel.rownemail }"></td>
					<td class="header" colspan=""></td>
				</tr>
			</table>
			</div>
<!-- 			End Tab 1 $****************************************************************-->
					
<%-- 			<s:set var="tntEdit">${empty param['rlrmid']? '':'input-readOnly'}</s:set>		 --%>
					
			<div id="tabs-2">
					<!-- 		Tab 2 -->
			<table class="tabs-2" style="width: 100%;" border="0">
				<tr >
					<td class="header">Status :</td>
					<td>
						<label class="radio-inline"> <input type="radio" checked
							name="model.tntModel.rtntstat" 
							 ${model.tntModel.rtntstat == 'Y' ? 'checked=""' : ''} class="ng-pristine ng-valid" value="Y" onclick = "RM007A.tntFunction(this.value);">
							Active
						</label> <label class="radio-inline"> <input type="radio" 
							name="model.tntModel.rtntstat" ${model.tntModel.rtntstat != 'Y' ? 'checked=""' : ''}
							class="ng-pristine ng-valid"  value="N" onclick = "RM007A.tntFunction(this.value);">
							Inactive
						</label>
					</td>
					<td class="header" colspan="2"</td>
				</tr>
				<tr >
					<td class="header">Prefix(Eng) :</td>
					<td><input id="prefixeng2" name="model.tntModel.rtntprenm"  type="text" value="${model.tntModel.rtntprenm }"></td>
					<td class="header">Prefix(Thai) :</td>
					<td><input id="prefixth2"  name="model.tntModel.rtntprlnm"  type="text" value="${model.tntModel.rtntprlnm }"></td>
				</tr>
				<tr >
				
					<td class="header">FirstName(Eng) :</td>
					<td><input id="firstNameEn2"  name="model.tntModel.rtntfsenm"  type="text" value="${model.tntModel.rtntfsenm }"></td>
					<td class="header">FirstName(Thai) :</td>
					<td><input id="firstNameth2" name="model.tntModel.rtntfslnm"  type="text" value="${model.tntModel.rtntfslnm }"></td>
				</tr>
				<tr >
					<td class="header">MidName(Eng) :</td>
					<td><input id="midNameEng2" name="model.tntModel.rtntmdenm"  type="text" value="${model.tntModel.rtntmdenm }"></td>
					<td class="header">MinName(Thai) :</td>
					<td><input id="midNameTh2"  name="model.tntModel.rtntmdlnm"  type="text" value="${model.tntModel.rtntmdlnm }"></td>
				</tr>
				<tr >
					<td class="header">LastName(Eng) :</td>
					<td><input id="lastNameEng2" name="model.tntModel.rtntlsenm"  type="text" value="${model.tntModel.rtntlsenm }"></td>
					<td class="header">LastName(Thai) :</td>
					<td><input id="lastNameTh2"  name="model.tntModel.rtntlslnm"  type="text" value="${model.tntModel.rtntlslnm }"></td>
				</tr>
				<tr >
					<td class="header">Nationality :</td>
					<td><input id="nationality2" name="model.tntModel.rtntnation"  type="text" value="${model.tntModel.rtntnation }"></td>
					<td class="header">Passport :</td>
					<td><input id="passport2"  name="model.tntModel.rtntpassno"  type="text" value="${model.tntModel.rtntpassno }"></td>
				</tr>
				<tr >
					<td class="header">Transfer Date :</td>
					<td><input id="tntTransferDate" name="model.tntModel.rtnttfsdat"  type="text" value="${rtnttfsdat }"></td>
					<td class="header">Tel. :</td>
					<td><input id="tel2"  name="model.tntModel.rtnttel"  type="text" value="${model.tntModel.rtnttel }"></td>
				</tr>
				<tr >
					<td class="header" valign="top">Email :</td>
					<td  valign="top"><input id="email2" name="model.tntModel.rtntemail"  type="text" value="${model.tntModel.rtntemail }"></td>
					<td class="header"  valign="top">Remark</td>
					<td  valign="top"><textarea id="remark" name="model.tntModel.rtntremrk" rows="8" cols="50">${model.tntModel.rtntremrk }</textarea></td>
				</tr>
			</table>
<!-- 			End Tab 2 -->
			</div>
			</div>
<!-- 			</form> -->
<!-- 			button -->
			<table>
				<tr><td align="left">
						<button type="button" class="btn btn-default btn-primary" onclick="location = 'RM007'"><i class="fa fa-hand-o-left"></i> Back</button>
					</td>
					<td align="right">
						<button id="btnSubmit" type="button" class="btn btn-default btn-primary"><i class="fa fa-save"></i> Save</button>
					</td>
				</tr>		
			</table>		
			
		</div>
	</div>
</div>
</form>
<script type="text/javascript">
	$( document ).ready(function(){
		 $( "#tabs" ).tabs();
	});
</script>
